/*  -*- mode: c++; coding: utf-8; c-file-style: "stroustrup"; -*-

    Copyright 2008 Asier Aguirre <asier.aguirre@gmail.com>
    This file is part of Intromit.

    Intromit is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Intromit is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Intromit.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef PYTHON_MISC_HH
#define PYTHON_MISC_HH

// TEST TO TRY ENUMS IN COMPLEX CONTEXTS

// sample enums
enum sample_enum {SAMP1=0, SAMP2, SAMP3, SAMPLAST};

struct embed_enum
{
    enum sample_enum {SAMP9=9, SAMP15=15, SAMP8=8, SAMP20=-20};

    struct embed_struct
    {
	enum sample_enum {SAMP_ESS0, SAMP_ESS1};

	class embed_class
	{
	public:
	    enum sample_enum {SAMP_CLASS};

	    union embed_union
	    {
		enum sample_enum {SAMP_UNION=-1};
	    };
	};
    };
};

// TEST NAMESPACES
namespace namespace_enum
{
    // GLOBAL VARIABLES INSIDE NAMESPACE
    int global_namespace_int=-999;

    enum sample_enum {SAMP_NAMESPC=-8, SAMP_NAMESPC_LAST};

    namespace namespace_nested
    {
	// another double namespace nested global variable
	double global_double=10.5;

	class namespace_class
	{
	    /* doc in members */
	    int x;
	public:
	    namespace_class();
	    namespace_class(int x);

	    /* doc to test */
	    int get_x();
	};

	// same name in different context
	struct embed_struct
	{
	    int sample_int;
	};
    };
};

// TEST INHERITANCE
class base
{
    int b;

public:
    base();
    virtual ~base();

    void set_b(int b);
    int get_b();

    virtual int virtual_method();
};

class derived1 : public base
{
    float d1;

public:
    derived1();
    ~derived1();

    void set_d1(float d1);
    float get_d1();

    int virtual_method();
    base *generalize_this();
};

class derived2 : public derived1
{
    double d2;

public:
    derived2();
    ~derived2();

    void set_d2(double d2);
    double get_d2();

    int virtual_method();
    derived1 *generalize_derived1();
    base *generalize_base();
};

// TEST INHERITANCE W/O CTOR AND DTOR
struct base_wo_ctor
{
    virtual ~base_wo_ctor();
    virtual int vmethod();
};

struct derived_wo_ctor : base_wo_ctor
{
    int vmethod();
    base_wo_ctor &generalize();
};

// TEST BASE CLASS CTOR/DTOR EXECUTION
struct exec1
{
    float member1;
};

struct exec2: exec1
{
    float member2;
    exec2();
    ~exec2();

    // if virtual is set in this function, exec1 inheritance base offset would be 4 bytes
    // intromit is not still ready for this!
    /*virtual*/ void set_member1(float value);
};

struct exec3: exec2
{
    float member3;
};

struct exec4: exec3
{
    float member4;
    exec4();
    ~exec4();
};

// TEST FUNCTIONS
void set_global_int(int v);
int get_global_int();
void set_global_float(float v);
float get_global_float();
void set_global_double(double v);
double get_global_double();
int func_poly();
int func_poly(unsigned short us);
int func_poly(float x);
int func_poly(double a, double b);

// TEST FUNCTIONS INSIDE NAMESPACE
namespace func_namespace
{
    int namespaced_func(int a, unsigned b);
}

#endif
